//console color
//$Id: console_color.h 523 2010-07-20 13:32:54Z Oleg.Bulychov $
#pragma once

#include <iostream>
//__________________________________________________________________________________
namespace sys_api
{
    void Set_Console_Color(unsigned);
}
//__________________________________________________________________________________
//__________________________________________________________________________________
struct black    { static unsigned value() { return  0; } };

struct blue     { static unsigned value() { return  1; } };

struct green    { static unsigned value() { return  2; } };

struct cyan     { static unsigned value() { return  3; } };

struct red      { static unsigned value() { return  4; } };

struct magenta  { static unsigned value() { return  5; } };

struct brown    { static unsigned value() { return  6; } };

struct ltgray   { static unsigned value() { return  7; } };

struct dkgray   { static unsigned value() { return  8; } };

struct ltblue   { static unsigned value() { return  9; } };

struct ltgreen  { static unsigned value() { return 10; } };

struct ltcyan   { static unsigned value() { return 11; } };

struct ltred    { static unsigned value() { return 12; } };

struct ltmagenta{ static unsigned value() { return 13; } };

struct yellow   { static unsigned value() { return 14; } };

struct white    { static unsigned value() { return 15; } };
//__________________________________________________________________________________
template<class F, class B>
inline std::ostream& color(std::ostream& ostr)
{
    unsigned color = F::value() | (B::value() << 4);
    sys_api::Set_Console_Color(color);
    return ostr;
}
//__________________________________________________________________________________
inline std::ostream& no_color(std::ostream& ostr)
{
    sys_api::Set_Console_Color(unsigned(-1));
    return ostr;
}
//__________________________________________________________________________________

//EOF!
